<?php
require_once($_SERVER['DOCUMENT_ROOT'].'/includes/site_defaults.php');
require_once($_SERVER['DOCUMENT_ROOT'].'/database/db.php');

if (!isset($_SESSION)) {
	session_start();
}

LoginUser();

$qry = "SELECT * FROM dealerships";
mysql_select_db($db_name, $db);
$dealerships = mysql_query($qry) or die(mysql_error());



?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
	<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
	<meta name="robots" content="nofollow, noindex" />
	<title>UnOfficial Green Auto Market Home Page</title>
	<link href="<?php echo $site_root."css/green.css"; ?>" rel="stylesheet" type="text/css" />
	<script src="js/jquery.js" type="text/javascript" charset="utf-8"></script>
	<script src="js/jquery-ui.js" type="text/javascript" charset="utf-8"></script>
	<script src="js/jquery.validate.js" type="text/javascript" charset="utf-8"></script>
	<script src="js/lib/jquery.form.js" type="text/javascript" charset="utf-8"></script>

	<script type="text/javascript" charset="utf-8">
		// function showDealer(id) {
		// 	$.get('dealer_detail.php', 'dealer_id='+id, function(data){
		// 		$('#dealer_'+id).html(data).slideDown("slow");
		// 		}, 'html');
		// };
	
	</script>
</head>

<body>	
	<?php include($header); ?>
	<?php include($navigation); ?>
	<div id="wrapper">
		<div id="contentcontainer">


			<div id="leftcol">
				<div id="leftcolcontain">


				</div><!--End of Left Column Container-->
			</div><!--End of Left Column-->

			<div id="rightcol">
				<div id="rightcolcontain">
					
				
			
				</div><!--End of Right Column Container--> 
			</div><!--End of Right Column-->

			<div id="content">
				<div id="contentcontain">
					
					<table border="0" cellspacing="0" cellpadding="1" width="100%">
						<tr>
							<th align="left">Dealer</th>
							<th align="left">Location</th>
							<th align="left">Phone</th>
						</tr>
					
						<?php while ($dealer = mysql_fetch_assoc($dealerships)) { ?>
						
							<tr>
								<td>
									<a href="dealer_detail.php?dealer_id=<?php echo $dealer["id"] ?>">
										<img src="<?php echo $images."zoom.png" ?>" width="16" height="16" 
											alt="Show Dealer Information" title="Show Dealer Information" />
										<?php echo $dealer["dealer_name"] ?>
									</a>
								</td>
								<td>
									<?php echo $dealer["city"].", ".$dealer["state_province"] ?>
								</td>
								<td>
									<?php echo $dealer["phone"] ?>
								</td>
								
							</tr>
							<tr>
								<td colspan="3" style="margin:0px; padding:0px;">
									<div id="dealer_<?php echo $dealer["id"] ?>" style="display:none;" class="drop_down"></div>
								</td>
							</tr>
						
						
						<?php } 
						
						mysql_free_result($dealerships);
						
						?>
						
						
						
						
						
					</table>
					

				</div><!--End of Content Contain-->    
			</div><!--End of Content-->

		</div><!--End of Content Container-->
	</div><!--End of Wrapper-->
	<?php include($footer); ?>
</body>

</html>